Important: When updating your code from a previous version of the framework, you definitly need to make sure that you update your copy of the file "MyConfiguration.h" to include all the new configuration options. If you don't, various bits of code simply won't be compiled/included in your application!
1.0 beta 12 - Saturday, December 10, 1995
AppleEvents and Threading
It turns out (as pointed out by the knowledgeable and observant Wayne K. Walrath - Thanks Wayne!) that my implementation of threading of AppleEvents was bad :-( Since AEProcessAppleEvent is not reentrant, it can't be set up as multi-threaded where it might be called more than once. So, I finally broke down and figured out how to use AESuspendTheCurrentEvent (which is not at all adequately explained in IM:IAC).
- 'CGIAESearchDoc' now has 4 companion functions: 'CGIAESearchDocProcessThread', 'cgiAESearchDocProcess', 'cgiAEComplete' and 'CGIAEResumeComplete'. You shouldn't actually need to worry about any of these since they are internal to the CGI framework code and not meant to be called by custom functions.
- 'theAppleEvent' parameter in 'cgiAEGetParamHTTPMethod', 'AEGetParamString', 'AEGetParamStringNoAlloc', 'AEGetParamShort' and 'AEGetParamLong' is now defined as const (as the universal headers say it should be).
- Removed threading from 'doHighLevelEvent' in "EventUtil.c". This was an invalid operation and has been replaced with (hopefully) correct usage in the CGI AppleEvent handler.
- The CGIRecord structure now includes pointers to the AppleEvent and the Reply AE. Also added more comments to the structure.
- Added the local variable vCGIAEResumeCompleteUPP to "CGI.c"
Symantec Support
- Now working for 68K projects!!!
- Added THINK Project Manager and Symantec Project Manager project files. The PowerPC project is still not working - I'm in contact with Symantec about this.
- Added #include <Types.h> to "Startup.c" for compiling with Symantec/THINK compilers.
- Added 'StringChar' function to "StringUtil.c" to make up for the non-standard behaviour of TPM's strchr library function. I've set the header file in such a way that other compilers will use the library function, but TPM/SPM will use the custom one.
- Added 'kCompiling_For_Symantec' to compiler_stuff.h
Metrowerks Support
- Added CodeWarrior 7 project files.
- Changed creator type of most of the source files to 'CWIE' the CodeWarrior IDE (cw7)
Interface
- added new function 'MyActivateWindow' to "MyHandlers.c".
- changed 'WindowActivate' to support 'MyActivateWindow'.
- Added 'Window_dlgModeless' to the 'window_type' enumeration in "WindowInt.h"
- Added some more "#if kCompileWithApplicationWindows" lines to "WindowInt.c"
Resources
- Renamed "Customize.rsrc" to "MyCustom.rsrc". Changed in "CGI.µ" as well.
Miscellaneous
- Added platform specific variation to MyAssert ("DebugUtil.c")
- 'MyCGIQuit' was missing the name of the Boolean parameter ('allowUserInteract'). I don't know why it compiled in CodeWarrior without the parameter being named, I wish it wouldn't.
- Added 'static' modifier to all local only functions. (CGI.c, ErrorUtil.c, EventUtil.c, ListSTAR.c, Main.c, Startup.c, WindowInt.c) (don't ask why this wasn't done before - probably just slothfulness on my part)
- New function 'ResetQuitIdleTimer' in "Quit.c". This needs to be called at the begining and end of any event which should reset the 'quit on idle time' timer.
- Corrected error handling during field allocation to set the name and value pointers of the current field to nil before trying to allocate memory for them. Then, if the alloc fails, the code won't try to deallocate them.
- Now using custom function StringChar instead of strchr (which is actually a macro that just uses strchr in the case of non-Symantec compilers - if that's not confusing enough for you ;-)
CGI Parameters, Documentation, References (where to find more info), Royalties (what and how to pay for this) cgi_params.html (by Chuck Shotton, included with permission)
Deleted Documents
"CGI Documentation" and "How To" (their contents are now in "CGI Parameters" and "Documentation")
1.0 beta 11 - Sunday, October 29, 1995
* EventUtil:
- Moved most of the update event code from 'doUpdateEvent' to 'WindowUpdate'
- 'doKeyPress' now calls 'MyKeyPress'
- 'doMouseDown' can now call 'MyDoStartDrag' if 'kCompileWithDragNDrop' configuration option is set.
- New external custom functions: 'MyKeyPress' and 'MyDoStartDrag'
* WindowInt:
- Added support for Window_Application window type. Any windows that have the WindowInfoHdl as their RefCon that have this type specified, will be passed to a custom close function ('MyCloseWindow' in "MyHandlers.c") that will allow the custom application to do any special clean-up that is required when a window is closed.
- Note: I really need to document the WindowInfoHdl stuff since this is the mechanism I use to track windows other than non-movable modal-dialogs. I'll just say for now that you should pay particular attention to the functions 'WindowNewSetInfo', 'WindowGetDataHdl', and 'WindowDisposeInfoHdl'.
- Added error detection to 'windowHasScrollBars'
- New functions: 'WindowNewSetInfo', 'WindowSetInfoHdl', 'WindowGetInfoHdl', 'WindowDisposeInfoHdl', 'WindowGetDataHdl', 'WindowUpdate'
- Modified "AboutBox.c" to not lose memory in the PPC code when allocating the UPP for the Icon drawing user item function. Affected functions: 'AboutBoxInit' and 'AboutBoxOpen'.
- Added comment to 'AEInstallHandlers'
- Added file type constants to "constants.h"
- New global: gHasDragNDrop
- Added 'startupDrag' (Drag Manager initialization) to "Startup.c"
- New Functions: 'MyStartup', 'MyQuit', 'MyOpenDocument', 'MyCGIQuit'
- Renamed 'myInstallAEHandlers' 'AEInstallHandlers' to avoid confusion.
- Moved the calls to 'MyCGIStartup' and 'MyListSTARStartup' from "Startup.c" to "MyHandlers.c".
- Rearranged the project files to have all the custom and optional sources / resource-files in one group called "Customize".
- New utility function 'ProcessGetMyFSSpec' in "ProcessUtil.c". Fills out an FSSpec with the application's location. Thanks go to Greg S. Combs.
- New optional (via "MyConfiguration.h") global variable 'gProcessFSSpec' that will automatically be filled in at startup with the location of the cgi application. Suggested by GSC.
- Changed some calls to 'HLockHi' to plain 'HLock' because moving the handle high in the heap - in those cases - was unnecessary and a waste of time.
- Configuration option for turning off AppleEvents being handled through spawning new threads. If you do turn this off, you are on your own for threading event handling.
- Moved the constant 'kProfileNameStr' from "compiler_stuff.h" to "MyConfiguration.h".
- Created configuration option for turning assertions on/off in "MyConfiguration.h". Modified "DebugUtil.h" so that you don't have to change it to determine whether assertions are on/off.
- Fixed bug in 'CGIDecodeSpecialChars'. Was accessing the wrong byte of theString in the second 'else if' line of determining the low order byte. 'theString[read+1]' has been corrected to 'theString[read+2]' in the two occurrances on that line. Big thanks to Stefan Strand of "Teknik i Media AB" for identifying my error.
- You will want to put a #if wrapper around any references you may have to gHasThreadMgr as in:
#if kCompileWithThreadsOptional
if ( gHasThreadMgr )
#endif
(be sure to include #include "MyConfiguration.h" in any such files)
This will work, even in cases like if (gHasThreadMgr) { some code } where you wrap it as #if kCompileWithThreadsOptional if ( gHasThreadMgr ) #endif { some code } because the stuff in {} will be treated as a block statement which (to my knowledge) will not affect compilation under C.
- A tonne of new configuration options. Located and explained in "MyConfiguration.h"
- Removed the storing of the AppleEvent Record and Reply Record in the CGIHdl since they weren't being used. The relevant lines (in CGI.h and CGIAESearchDoc) were just commented out, so can easily be replaced if you really want them.
- Now using global variable 'gIdleTimeToQuit' instead of constant 'kIdleTimeToQuit' to check the idle time. 'gIdleTimeToQuit' is initialized to 'kIdleTimeToQuit' on startup, but can be changed at any time you want to after that (IE. your initialization code or on an interface call).
- Added global 'gDoIdleQuitOnOpenApp' which starts off set to the 'kCompileWithIdleQuitOnOpenApp' configuration option. This is basically a flag which tells whether the application will quit after the idle time even if the application was just opened ordinarily (OpenApplication AppleEvent - not CGI launch).
- Moved the memory constants to "MyConfiguration.h" from "MemoryUtil.h" to make changing them more convenient.
- Added new stuff to the "How To" document, including: Modifying/adding menus and menu items. New document (incomplete) describing the CGIRecord/CGIHdl data structure and how it works.
- Increased 'kCGIParamMaxSize' to hold the actual maximum parameter size.
- QuitPrepare now checks event queue for any outstanding high level events (Apple Events) and processes them before quitting. This will hopefully prevent, or at least reduce, lost events if a CGI call is made to the CGI as it is preparing to quit.
Added Send Partial AppleEvent support (Warning: untested)
New AppleEvent parameters:
- 'Pvrs' - 'version' - version number of the http server.
- 'Kcid' - 'connection' - connection ID used by send partial events.
New CodeWarrior Profiler support.
- Additions to "Compiler_Stuff.h", "Globals.h" and 'main' in "Main.c".
Rearranged resource files:
- "essential.rsrc" must be included.
- "Customize.rsrc" should be modified to meet the individual application's need.
- "ListSTAR.rsrc" must be included in projects that support the ListSTAR events.
- "CGI aete.rsrc" is the AppleScript resource for applications that only support CGI events.
- "ListSTAR aete.rsrc" is the AppleScript resource for applications that only support ListSTAR events.
- "CGI and ListSTAR aete.rsrc" is the AppleScript resource for applications that support both CGI and ListSTAR events.
New Compiling Configuration Options. (These help with optimization)
- See the new file "MyConfiguration.h" for details.
- One of the new configuration options is to compile as a background-only application.
Miscellaneous
- Added string to http headers 'STR#' resource for multipart server push response.
- Added 'kAEMyTimeoutInTicks' constant to the "AEFunc.h" header.
- Added code to 'doMenu' in "MenuFunc.c", to reset the self-quit timer on menu events.
- Removed unused code in main event loop (cursor adjustment)
- Changed 'ErrorStartup' to use 'ExitToShell' (removed extraneous 'ExitToShell' calls from "Startup.c".
- Moved modeless dialog support from main event loop to mouse up/down handlers.
- Changed 'ProcessIsFront' to take a ProcessSerialNumber instead of a long.
- Increased 'kSleepTicks' to 2 seconds to allow other processes to have more time.
1.0 beta 7 - Saturday, August 12, 1995
- Added code to quit after given period of no activity (kIdleTimeToQuit in "Constants.c"). Affected functions 'doIdle', 'doAEOpenApp', 'StartupApplication' and 'CGIAESearchDoc'.
- Rearranged the source folders a bit and moved the rsrc files into their own folder.
- Corrected ListSTAREvent 'aete' to have the correct class.
- Changed 'triggerValue' field of 'ListSTARRecord' to be a 'long *' so it can be properly added to the AppleEvent reply.
1.0 beta 6 - Friday, August 11, 1995
- Fixed AboutBox to use UniversalProcPtr for the Icon user item.
- Finally tracked down the "losing pointers" problem with the threaded code! I wasn't properly recycling the threads.
- Now checking for missed required params in CGI Apple Event.
1.0 beta 5 - Tuesday, August 8, 1995
- Added 'MyCGIStartup' function to "MyCGI.c". Allows for easily adding to the startup sequence without having to modify the framework.
- Fixed 'cgiDisposeHandle' to actually dispose the handle (ouch, what a memory leak!) as well as a few other leaks in "CGI.c". I told you this was beta code!
- Moved 'cgiAEGetParamString' and 'cgiAEGetParamShort' from "CGI.c" to 'AEGetParamString' and 'AEGetParamShort' in "AEFunc.c".
- Removed unneccessary 'actualType' variable from 'CGIAESearchDoc'.
- Added more assertions to various functions.
- Moved calls to cgi initialization code from 'main' function to 'StartupApplication'.
- Moved code to install CGI AppleEvent to the 'InitCGIUtil' function.
- Added basic support for ListSTAR trigger and action events. (easy to not include if you don't want this, see the section on "ListSTAR Event Stuff" above).
- Added two new 'aete' resources to support the ListSTAR event or both CGI and ListSTAR events. Be sure to use only one of the included 'aete' resources.
- Corrected original 'aete' resource #0 to use 'TEXT' instead of 'char' for parameter types.
- Now disposing of window info handle when about box closes. All about box memory leaks fixed.
- Now, I ask you, why would I be HLocking a DialogPtr in 'aboutBoxAppIcon' ??? (fixed)
- Added 'gQuit = true;' line to 'MyCGIProcess' so that the cgi will quit after it finishes processing cgi events. This is a kludgy hack that will go away once I get around to writing a proper quit timer.
1.0 beta 4 - Sunday, August 6, 1995
- 'CGIFormFieldsFindRecord' now takes a CGIHdl as it's first parameter, rather than a CGIFormField*. See the function’s comments for instructions.
- Updated and expanded the documentation.
- Added "compiler_stuff.h" (#included in every source file) to help deal with differences between compiler environments.
- Added code to "mainEventLoop" to yield more often if there is more than one sub-thread.
- Split "cgi.rsrc" into two files ("cgi.rsrc" and "MyCGI.rsrc"). The "MyCGI.rsrc" is for resources that may need to change for individual cgi applications. "cgi.rsrc" is for resources that shouldn't need to change.
- Found friend in Ottawa with a MW/PPC compiler (no PowerPC, though) so I made some changes to the PPC project file.
- Changed "Event.c" to "EventUtil.c".
1.0 beta 3 - Friday, August 4, 1995
Hopefully last beta before first golden release...
[boy was I ever optimistic when I wrote that!]
- Added MW/PPC project file and fat application.
- Moved 'MyCGIProcess' to it's own file.
- Changed thread code to use pre-allocated pool of threads. Maximum number of 5 sub-threads at any one time (change the constant 'kStartupThreadsPreallocate' in "Startup.c" to have a different number). This will improve performance, especially on very busy systems.
- Added thread support in "ProcessUtil.c", "AEFunc.c", "AEHandlers.c", "CGI.c", "WindowInt.c", "main.c" and "Quit.c"
- Fixed bug in dialog event filter "DialogUtil.c"
1.0 beta 2 - Tuesday, August 1, 1995
PowerPC code fix. The following files were updated:
- ErrorInt.c
Added use of NewModalFilterProc in ErrorAlertSystemString and ErrorAlertStartupString
functions.
- main.c
Corrected documentation comment for MyCGIProcess function.
- MemoryUtil.c
Added use of NewGrowZoneProc in InitializeEmergencyMemory function.
- Startup.c
Commented out troublesome line in startupThreads function.